﻿using System.Domain.Entity;
using System.Repository.DataBase.Models;
using Microsoft.EntityFrameworkCore;

namespace System.Repository.DataBase
{
    public class Test
    {
        public Test()
        {
            var contextOptions = new DbContextOptionsBuilder()
                .UseSqlServer("Server=.;Initial Catalog=JewelleryManage;User ID=sa;Password=123456;")
                .Options;

            using (var context = new LiAnDbContext(contextOptions))
            {

            }
        }
    }

    public class LiAnDbContext : DbContext
    {
        //  private readonly string _connectionString = "Server=.;Initial Catalog=JewelleryManage;User ID=sa;Password=123456;";

        //public LiAnDbContext(string connectionString)
        //{
        //    if (string.IsNullOrEmpty(connectionString))
        //    {
        //        _connectionString = connectionString;
        //    }
        //}
        public LiAnDbContext(DbContextOptions options) : base(options)
        {
        }

        //protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        //    => optionsBuilder.UseSqlServer(_connectionString);



        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Sys_User>().ToTable("Sys_User");
            //modelBuilder.Entity<Enrollment>().ToTable("Enrollment");
            //modelBuilder.Entity<Student>().ToTable("Student");
        }

        //public virtual DbSet<Shop_AccountsRecord> Shop_AccountsRecord { get; set; }

        //public virtual DbSet<Shop_Colour> Shop_Colour { get; set; }

        //public virtual DbSet<Shop_Goods> Shop_Goods { get; set; }

        //public virtual DbSet<Shop_Goods_Details> Shop_Goods_Details { get; set; }

        //public virtual DbSet<Shop_Goods_Image> Shop_Goods_Image { get; set; }

        //public virtual DbSet<Shop_Goods_Repertory> Shop_Goods_Repertory { get; set; }

        //public virtual DbSet<Shop_Goods_Sculpt> Shop_Goods_Sculpt { get; set; }

        //public virtual DbSet<Shop_Goods_Type> Shop_Goods_Type { get; set; }

        //public virtual DbSet<Shop_Material> Shop_Material { get; set; }

        //public virtual DbSet<Shop_Material_Type> Shop_Material_Type { get; set; }

        //public virtual DbSet<Shop_MeasureUnit> Shop_MeasureUnit { get; set; }

        //public virtual DbSet<Shop_SaleUnit> Shop_SaleUnit { get; set; }

        //public virtual DbSet<Shop_SellingRecord> Shop_SellingRecord { get; set; }

        public virtual DbSet<Sys_DbBackup> Sys_DbBackup { get; set; }

        public virtual DbSet<Sys_Module> Sys_Module { get; set; }

        public virtual DbSet<Sys_ModuleAuthorize> Sys_ModuleAuthorize { get; set; }

        public virtual DbSet<Sys_OperationLog> Sys_OperationLog { get; set; }

        public virtual DbSet<Sys_Organize> Sys_Organize { get; set; }

        public virtual DbSet<Sys_ProgramLog> Sys_ProgramLog { get; set; }

        public virtual DbSet<Sys_Role> Sys_Role { get; set; }

        public virtual DbSet<Sys_RoleAuthorize> Sys_RoleAuthorize { get; set; }

        public virtual DbSet<Sys_User> Sys_User { get; set; }

        public virtual DbSet<Sys_UserLogOn> Sys_UserLogOn { get; set; }
    }
}
